﻿using System;
using System.Collections.Generic;
using System.Linq;
using Fuse8.ContentManagementFramework.Domain;
using Fuse8.ContentManagementFramework.Domain.Commands;
using Fuse8.ContentManagementFramework.Domain.Commands.CommandParameters;
using Fuse8.DomainFramework.Common.Locator;

namespace Fuse8.ContentManagementFramework.BizFacade.Services
{
    public class CmsDashboardService : CmsBusinessService<CmsDashboard>
    {
        public IEnumerable<CmsDashboard> FindByUser (CmsUser user)
        {
            var command = DependencyServiceLocator.Current.GetInstance<CmsDashboardSelectForUserCommand>();

            var commandParameter = new CmsDashboardSelectForUserCommandParameter();

            commandParameter.UserId = user.Id;

            SiteAwareEntityObjectMediator.SetSiteEntity(commandParameter);

            command.ConfigureCommand(commandParameter);

            return this.Find(command);
        }
    }
}
